package geppetto.reordering.graph.scorers;

import geppetto.phraseHMM.WordTrie;
import geppetto.phraseHMM.phraseExtraction.extractedphrase.ExtractedPhrasePair;
import geppetto.reordering.graph.GraphWeightScorer;
import geppetto.reordering.graph.ReorderingGraph;

public class SourceSegmentationScorer extends UnweightedGraphScorer{
	
	WordTrie sourceWords;
	
	public SourceSegmentationScorer(WordTrie sourceWords) {
		this.sourceWords = sourceWords;
	}
	
	@Override
	public double scoreNode(ExtractedPhrasePair node) {
		if(ReorderingGraph.isStartNode(node) || ReorderingGraph.isEndNode(node)){
			return 1;
		}
		return sourceWords.getPhraseFrequency(node.getSourcePhrase());
	}

}
